package UI;

import java.io.File;
import java.io.IOException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;

public class Program {
	
	public Program(File file){
		
		/*
		 * generate a table for the execution of the program
		 */
		
		
		//parse the string into xml document
		DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
		builderFactory.setIgnoringElementContentWhitespace(true);	
		DocumentBuilder builder = null;
		try {
			builder = builderFactory.newDocumentBuilder();
		}catch(ParserConfigurationException e) {
				e.printStackTrace();
				System.exit(1);
		}
			//System.out.println("Builder Factory = " + builderFactory + "\n Builder = " + builder);
			

		
		Document program = null;
		
		try {
			program = builder.parse(file);
		}catch(SAXException e) {
			e.printStackTrace();
			System.exit(1);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		programRoot = program.getDocumentElement();
	
		//System.out.println(program);
		
	}
	
	
	public Program(String programString){
		
	}
	
	
	private Element programRoot;





	public Element getProgramRoot() {
		return programRoot;
	}





	public void setProgramRoot(Element programRoot) {
		this.programRoot = programRoot;
	}
	

}
